package abc;

import javax.swing.*;

public class BiaoBai extends JFrame {

    public static void main(String[] args) {
        JFrame frame=new JFrame("姑娘，做我女朋友吧！");
        JOptionPane.showMessageDialog(null,"十年相遇");
        JOptionPane.showMessageDialog(null,"百年回眸");
        JOptionPane.showMessageDialog(null,"千年同船渡");
        JOptionPane.showMessageDialog(null,"我愿以万年的等待");
        JOptionPane.showMessageDialog(null,"百世的轮回");
        JOptionPane.showMessageDialog(null,"换你今朝一世情缘,可否？");
        frame.setSize(500,500);
        frame.setLocation(320,240);
        frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        frame.setVisible(true);


        // 创建关闭按钮
        JButton closeBtn = new JButton("好");
        closeBtn.addActionListener(e -> {
            JOptionPane.showMessageDialog(null,"那赶快去领证吧！！！");
            frame.dispose(); // 关闭窗口
        });
        frame.add(closeBtn);

        // 创建禁用按钮
        JButton disabledBtn = new JButton("滚");
        disabledBtn.setEnabled(false); // 禁用按钮
        frame.add(disabledBtn);

        frame.setLayout(null); // 设置布局为自由布局
        closeBtn.setBounds(50, 50, 80, 30); // 设置关闭按钮位置和大小
        disabledBtn.setBounds(150, 50, 80, 30); // 设置禁用按钮位置和大小
        frame.setVisible(true);

    }
}
